﻿$(function () {


});


var turnToPage = function (url) {
    window.location.href = url;
}

var deleteRequire = function (keyid) {

    var jsonObj = {  "RequireID": keyid, "UserID": "0" };
    $.ajax({
        type: "post",
        url: "/RequireBug/Bug/Delete",
        data: JSON.stringify(jsonObj),
        dataType: "json",
        contentType: "application/json",
        success: function (e) {
            window.location.href = "/RequireBug/Bug/Index";
        }
    });
}

var changePageIndex = function (btnIndex)
{
    if (btnIndex == "1")
    {
        var curPageIndex = $("#hidPageIndex").val();
        var changePageIndex =parseInt( curPageIndex) - 1;
        $("#hidPageIndex").val(changePageIndex < 1 ? 1 : changePageIndex);
    }
    else if (btnIndex == "2") {
        var curPageIndex = $("#hidPageIndex").val();
        var changePageIndex = parseInt(curPageIndex) + 1;
        var maxPageIndex = $("#hidMaxPageIndex").val();
        $("#hidPageIndex").val(changePageIndex > maxPageIndex ? maxPageIndex : changePageIndex);
    }
    else if (btnIndex == "3") {
        var maxPageIndex = $("#hidMaxPageIndex").val();
        $("#hidPageIndex").val(maxPageIndex);
    }
    else {
        $("#hidPageIndex").val("1");
    }
    $("#searchForm").submit();

}





